#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Predesys - Predesys Bluetooth Proxy
# Version: 0.1.0
# Author: Jose A. Jimenez <jajimc@gmail.com>
# License: GPL 3.0 (see "license" file)

import sys
sys.dont_write_bytecode = True
import bluetooth

ADDRESS = ""
CHANNEL = 5 
BUFFER = 1024

def get_request():
    request = ""
    
    with open("request", "r") as requestFile:
        request += requestFile.read(1024)
        
    return request[:len(request)-1]

if __name__ == "__main__":
    request = get_request()
    clientSocket = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
    clientSocket((ADDRESS, CHANNEL))
    clientSocket.send(request)
    response = clientSocket.recv(BUFFER)
    clientSocket.close()
    
    print "Response:\n"
    print response
